package com.xinzhi.controller;

import com.xinzhi.pojo.Year;
import com.xinzhi.service.GradeAppealService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class   GradeAppealController {
    @Autowired
    private GradeAppealService gradeAppealService;

    /**
     * 绩申诉根据年份、类型、状态查询的接口成
     * @param yearNumber
     * @param appealType
     * @param statet
     * @return
     */
    @GetMapping("/selectAll")
    public List<Year> selectAll(
            @RequestParam(required = false) String yearNumber,
            @RequestParam(required = false) String appealType,
            @RequestParam(required = false) String statet) {
        return gradeAppealService.selectAll(yearNumber, appealType, statet);
    }


    /**
     * 成绩申诉根据年份查询接口
     * @return
     */
    @GetMapping("/fetchYearOptions")
    public ResponseEntity<?> fetchYearOptions() {
        return ResponseEntity.ok(gradeAppealService.getYearOptions());
    }

    /**
     * 成绩申诉根据类型查询接口
     * @return
     */
    @GetMapping("/fetchAppealTypeOptions")
    public ResponseEntity<?> fetchAppealTypeOptions() {
        return ResponseEntity.ok(gradeAppealService.getAppealTypeOptions());
    }

    /**
     * 成绩申诉根据状态查询接口
     * @return
     */
    @GetMapping("/fetchStatusOptions")
    public ResponseEntity<?> fetchStatusOptions() {
        return ResponseEntity.ok(gradeAppealService.getStatusOptions());
    }
}
